<template>
    <layout :config="navConfig">
        <template #default>
            <div class="m-review-tab">
                <label style="width: 100%">
                    <input type="radio" style="width: 100%" v-model="activeTab" :value="1">
                    <span style="width: 100%">个人收款信息</span>
                </label>
                <!--<label>-->
                <!--<input type="radio" v-model="activeTab" :value="2">-->
                <!--<span>支付宝转账</span>-->
                <!--</label>-->
                <!--<label>-->
                <!--<input type="radio" v-model="activeTab" :value="3">-->
                <!--<span>银行转账</span>-->
                <!--</label>-->
            </div>

            <div class="m-review-form" v-show="activeTab===1">
                <div class="form-col">
                    <div class="col-text">微信账户</div>
                    <input type="tel" v-model="formData.wechatqrcode">
                </div>
                <div class="form-col">
                    <div class="col-text">支付宝账户</div>
                    <input type="tel" v-model="formData.alypayqrcode">
                </div>
                <div class="form-col">
                    <div class="col-text">银行卡号</div>
                    <input type="text" v-model="formData.banknum">
                </div>
                <div class="form-col">
                    <div class="col-text">所属银行</div>
                    <input type="number" v-model="formData.bankname">
                </div>

            </div>


            <button class="m-review-button" @click="confirm">确认修改</button>
        </template>
    </layout>
</template>

<script lang="ts">
    import {Component, Vue} from "vue-property-decorator";
    import {INavigation} from "@/types";
    import qrCode from "vue-qr";
    import {Toast} from "mand-mobile";
    @Component({
        name: "Review",
        components: {
            qrCode
        },
        created: function () {
            Toast.loading("请求中...");
            let usera = JSON.parse(localStorage.getItem('users1'));
            this.$api.getUser({username:usera.username}).then(res => {
                Toast.hide();
                if (res.success == 200) {
                    this.formData = res.data;
                    console.log(res.data);
                }
            }).catch(res => {
                Toast.hide();
            })

            console.group('------created创建完毕状态------');
        },
    })
    export default class extends Vue {
        navConfig: INavigation = {
            text: "个人信息"
        };
        type=1;
        paymoney= 0;
        activeTab = 1;
        formData = {
            id:"",
            alypayqrcode:"",
            wechatqrcode:"",
            bankname: "",
            banknum: "",
            bankaddr: "",
            commit: "",
        };
        confirm() {
            Toast.loading("请求中...");
            this.$api.updateUser(this.formData).then(res => {
                Toast.hide();
                if (res.success == 200) {
                    Toast.info("修改成功",500);
                    console.log(res.data);
                }else{
                    Toast.info("修改失败",500);
                }
            }).catch(res => {
                Toast.hide();
                Toast.info("修改失败",500);
            })
        }
    }
</script>

<style lang="scss">
    @import "../assets/styles/review.scss";
</style>

